<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="../../../common/taglib.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<sfa:mainTitle></sfa:mainTitle>
		<%@ include file="../../../common/meta.jsp"%>
</script>
<script type="text/javascript"
			src="${path}/script/lhgdialog/lhgdialog.min.js"></script>
		<script type="text/javascript">

$(function() {
	$("#fullScreen").click(function() {
		fullScreen.FullScreen("mytable");
	});
	
	$("td[ipAddr]").each(function(){
		var ss = $(this).attr("ipAddr");
		var that = this;
		load_script('http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js&ip='+ss,function(){
			if(typeof(remote_ip_info) != "undefined" && remote_ip_info!='-2'){
				var area = remote_ip_info.province+remote_ip_info.city;
				if(typeof(remote_ip_info.province) == "undefined")
					$(that).next("td").html('未知地区');
				else
					$(that).next("td").html(remote_ip_info.province+remote_ip_info.city)
			}
			else
				$(that).next("td").html('未知地区');
		});
	});
});

function ajaxTakeArea(ip){
	$.ajax({
		type:'post',
		dataType:'jsonp',
		url:'http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=json&ip=120.85.255.255',
		success:function(data){
			alert("dd");
			var json = eval('(' + data + ')');
		}
	});
}


function load_script(url, callback) {
		var dd;
		var head = document.getElementsByTagName('head')[0];
		var script = document.createElement('script');
		script.type = 'text/javascript';
		script.src = url;
		//借鉴了jQuery的script跨域方法
		script.onload = script.onreadystatechange = function() {
			if ((!this.readyState || this.readyState === "loaded" || this.readyState === "complete")) {
				dd = callback();
				// Handle memory leak in IE
				script.onload = script.onreadystatechange = null;
				if (head && script.parentNode) {
					head.removeChild(script);
				}
			}
		};
		// Use insertBefore instead of appendChild to circumvent an IE6 bug.
		head.insertBefore(script, head.firstChild);
		return dd;
	}

	function openChart(url) {
		$.dialog({
			title : '趋势图',
			lock : true,
			background : '#FFF',
			opacity : 0.1,
			max : true,
			min : true,
			width : '700px',
			height : '450px',
			content : 'url:' + url
		});
	}

	$(document).ready(function() {
		if ("${msg}")
			alert("${msg}");
	});
</script>

	</head>

	<body id="master">

		<sfa:mainHeader></sfa:mainHeader>
		<!--右边-->
		<div class="webpart3 contentarea">
			<div class="webpart-head">
				<div class="webpart-head-item">
					登录日志
					<div class="tools-btn">
						<a href="####" id="fullScreen"><span> <img
									src="${path}/statics/images/qp.gif"
									style="margin-right: 4px; margin-bottom: -3px;" />全屏</span> </a>
					</div>
				</div>
			</div>
			<div class="webpart-main">
				<div class="webpart-main-item" style="padding-top: 12px;">
					<%--<div class="search">
						<!----------- 查询信息 ------------------>
						<form method="get">
							<table cellpadding="0" cellspacing="0">
								<tr>
									<th>
										开始日期：
									</th>
									<td>
										 <input type="text" class="input-txt" readonly="readonly" id="fromDate"
										name="fromDate" value="${fromDate}"
										onclick="WdatePicker({dateFmt:'yyyyMMdd'})" />
									</td>
									<th>
										结束日期:
									</th>
									<td>
										<td>
										 <input type="text" class="input-txt" readonly="readonly" id="toDate"
										name="toDate" value="${toDate}"
										onclick="WdatePicker({dateFmt:'yyyyMMdd',realDateFmt:'yyyyMMdd',minDate:'#F{$dp.$D(\'fromDate\',{d:0});}'})" />
									</td>
									</td>

									<td>
										<input type="submit" class="linkbtn2" value="查询" />
										<input type="button" class="linkbtn2" value="清空"
											onclick="location.href='${path}/manage/loginlogs/index/getlogs';" />
									</td>
								</tr>

							</table>
						</form>
					</div>
					--%><!----------- 数据列表 ------------------>
					<table cellpadding="0" cellspacing="0"
						class="dg_borderstyle trStyleTable"
						style="margin-top: 15px; line-height: 23px;" id="mytable">
						<tr>
							<th>
								序号
							</th>
							<th>
								用户名
							</th>
							<th>
								登录日期
							</th>
							<th>
								浏览器
							</th>
							<th>
								终端
							</th>
							<th>
								IP地址
							</th>
							<th>
								所在地区
							</th>
						</tr>
						<c:forEach items="${pagination.resultList}" var="logs">
							<tr>
							<td align="center">
									${logs.vcol1}
								</td>
								<td align="center">
									${logs.loginname}
								</td>
								<td align="center">
									${logs.createdate}
								</td>
								
								<td align="center">
									${logs.explorertype}
								</td>
								
								<td align="center">
									${logs.terminaltype}
								</td>

								<td ipAddr="${logs.userip}">
									${logs.userip}
								</td>
								
								<td>
										<img src="${path}/images/059.gif"
													style="width: 10px; height: 10px;" /> 
								</td>
								
							</tr>
						</c:forEach>
					</table>

					<!----------- 翻页导航 ------------------>
					<div class="dg_pagerstyle">
						<div class="pageinfo">
							第${pagination.page }页 | 共${pagination.totalPages
							}页/${pagination.totalRows }条记录
						</div>
						<div class="pagebtn">
							${pagination.multiPage}&nbsp;
						</div>
					</div>

				</div>
			</div>
			<div class="webpart-foot">
				<div class="webpart-foot-item">
				</div>
			</div>
		</div>

		<sfa:mainFooter></sfa:mainFooter>

	</body>
</html>


